#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;
class Solution {
public:
    std::vector<std::vector<std::string>> groupAnagrams(vector<string>& strs) {
        unordered_map<string, vector<string>> ans;
        for(string& str : strs)
        {
            string key = str;
            sort(key.begin(), key.end());
            ans[key].emplace_back(str);
        }
        vector<vector<string>> cnt;
        for(auto it = ans.begin(); it != ans.end(); it++) cnt.emplace_back(it->second);
        return cnt;
    }
};

int main() {
    return 0;
}